import React, {Component} from 'react';
import { createStore, applyMiddleware, combineReducers } from 'redux';
import { Provider } from 'react-redux';
import thunk from 'redux-thunk';

import * as reducers from './reducers';
import CounterApp from './counterApp';
import { View, Text, } from 'react-native';

const createStoreWithMiddleware = applyMiddleware(thunk)(createStore);
const reducer = combineReducers(reducers);
const store = createStoreWithMiddleware(reducer);

export default class App extends Component {
  render() {
    console.log('-->> AppCounter <<--', store);
    return (
      <Provider store={store}>
        <View style={{ padding: 10, alignItems: 'center', justifyContent: 'center' }}>
          <Text>Counter App</Text>
        </View>
        <CounterApp />
      </Provider>
    );
  }
}
